#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
// 拷贝一张图片
// 使用open、read、write等系统调用
void test1() {
	int fd = open("asset/youshenaoyi.jpg", O_RDONLY);
	lseek(fd, 0, SEEK_END);
	const int len = ftell(fd);
	lseek(fd, 0, SEEK_SET);
	char* buf[len];
	read(fd, buf,len);
	close(fd);
	int fd2 = open("1.jpg", O_CREAT | O_TRUNC);
	write(fd2, buf, len);
	close(fd2);
}
int main() {
	test1();
	return 0;
}